#include <vector>
#include <functional>
#include <iostream>

template<typename... Args>
class Signal {
public:
     using SlotType = std::function<void(Args...)>;

     void connect(SlotType slot) {
         slots.push_back(slot);
     }

     void emit(Args... args) {
         for(auto& slot: slots) {
             slot(args...);
         }       
     }
private:
     std::vector<SlotType> slots;
};


class MyClass : public Signal<int, std::string> {
public:
      void triggerSignal(int value, const std::string& text) {
          emit(value, text);
      }

      void mySlot(int value, const std::string& text) {
          std::cout << "Slot called with value: " << value << " and text: " << text << std::endl;
      }
    
}; 


int main() {
   MyClass obj;
   obj.connect([&](int value, const std::string& text) {
         obj.mySlot(value, text);
      });

   obj.triggerSignal(42, "Hello World!");
   return 0;
}
